<template>
	<view class="page">
		<view class="list">
			<view class="item">
				<view class="label">支付宝账号</view>
				<input type="text" placeholder="请输入" placeholder-class="placeholder" v-model="model.aliaccount">
			</view>
			<view class="bank">
				<view class="title">银行卡信息</view>
				<view class="item">
					<view class="label">银行名称</view>
					<input type="text" placeholder="请输入银行名称" placeholder-class="placeholder" v-model="model.bank_name"/>
				</view>
				<view class="item">
					<view class="label">开户行</view>
					<input type="text" placeholder="请输入开户行" placeholder-class="placeholder" v-model="model.open_name"/>
				</view>
				<view class="item">
					<view class="label">收款卡号</view>
					<input type="number" placeholder="请输入收款卡号" placeholder-class="placeholder" v-model="model.account"/>
				</view>
				<view class="item">
					<view class="label">收款人姓名</view>
					<input type="text" placeholder="请输入收款人姓名" placeholder-class="placeholder" v-model="model.real_name"/>
				</view>
			</view>			
			<view class="logout" @click="save">
				保存
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				model:{
					id:null
				}
			}
		},
		onLoad() {
			let userInfo = uni.getStorageSync('userInfo')
			this.rq.getData('user/bank').then(res=>{
				this.model = res.data
				this.model.id = JSON.parse(userInfo).id
			})
			
		},
		methods: {
			go(url){
				uni.navigateTo({
					url:url
				})
			},
			save(){
				this.rq.getData('user/bankSave',this.model).then(res=>{
					if(res.code === 1){
						uni.showToast({
							title:'保存成功~',
							icon:'none',
							success() {
								setTimeout(()=>{
									uni.navigateBack()
								},1000)
							}
						})						
					}
				})			
			},
		}
	}
</script>
<style>
	.placeholder{
		font-size: 26rpx;
		color: #999999;
	}
</style>
<style lang="scss" scoped>
	.page{
		height: 100vh;
		overflow: hidden;
		
		.list{
			padding: 24rpx;
			.item{
				background: #fff;
				height: 92rpx;
				box-sizing: border-box;
				padding: 28rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 20rpx;
				border-radius: 20rpx;
				
				.label{
					font-size: 28rpx;
					color: #333333;
				}
				
				input{
					flex: 1;
					text-align: right;
				}
			}
			.bank{
				background: #fff;
				border-radius: 20rpx;
				padding: 20rpx 0;
				
				.title{
					padding-left: 28rpx;
					font-size: 28rpx;
					color: #333333;
					font-weight: bold;
					margin: 20rpx 0;
				}
				
				.item{
					padding: 0 28rpx;
					margin-bottom: 0;
				}
			}
			
		}
		
		.logout{
			margin: 176rpx auto;
			height: 92rpx;
			width: 702rpx;
			border-radius: 100rpx;
			background: #FF5866;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			color: #FFFFFF;
		}
	}
</style>
